home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / ARPSample / ARPerations.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.9 KB  |  99 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ARPerations.h
  3.  
  4.     Contains:    Interface to the standard ARP operations
  5.  
  6.     Written by: Quinn "The Eskimo!"    
  7.  
  8.     Copyright:    Copyright © 1997-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/21/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24. // Pick up the standard UInt32 and Handle types.
  25.  
  26. #include <Types.h>
  27.  
  28.  
  29. OSStatus ARPGetCacheReport(Handle cacheReport);
  30.     // Gets a report about the contents of the ARP
  31.     // cache in standard Macintosh 'TEXT' format.
  32.     // You must create the handle before calling this routine
  33.     // and dispose it after it returns.  The routine will
  34.     // resize as appropriate.
  35.  
  36.  
  37. OSStatus ARPAddEntry(char *interfaceName,
  38.                         UInt32 arpProto,
  39.                         UInt32 flags,
  40.                         void *protoAddress, UInt32 protoSize, void *protoMask,
  41.                         void *hardwareAddress, UInt32 hardwareSize);
  42.     // Add an entry to the ARP cache for the given
  43.     // interface.  arpProto is the ARP
  44.     // protocol type, typically IP_ARP_PROTO_TYPE for 
  45.     // IP ARP.  See "OTARPModule.h" for
  46.     // a description of the flags parameter.  protoAddress
  47.     // is a pointer to the protocol address.  protoSize
  48.     // is the length of the protocol address.  These would
  49.     // normally be &InetHost and sizeof(InetHost) respectively.
  50.     // protoMask is a pointer to the protocol mask for this
  51.     // entry.  Normally you would pass a protoMask of $FFFFFFFF.
  52.     // I'm not sure what other values do.  hardwareAddress
  53.     // and hardwareSize specify the hardware address for the
  54.     // entry.  For an Ethernet-style interface, these are
  55.     // a pointer to the Ethernet address and 6 respectively.
  56.  
  57. OSStatus ARPDeleteEntry(char *interfaceName,
  58.                         UInt32 arpProto,
  59.                         void *protoAddress, UInt32 protoSize);
  60.     // Delete an entry from the ARP cache for the given
  61.     // interface.
  62.     // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
  63.     // for IP ARP.
  64.     // protoAddress and protoSize specify the
  65.     // protocol address of the entry to delete.  These would
  66.     // normally be &InetHost and sizeof(InetHost) respectively.
  67.     
  68. OSStatus ARPCacheQuery(char *interfaceName,
  69.                         UInt32 arpProto,
  70.                         void *protoAddress, UInt32 protoSize,
  71.                         void *hardwareAddress, UInt32 hardwareSize, UInt32 *flags);
  72.     // Look up an entry in the ARP cache for a given
  73.     // interface.    
  74.     // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
  75.     // for IP ARP.
  76.     // protoAddress and protoSize specify the
  77.     // protocol address of machine you are looking up.  These would
  78.     // normally be &InetHost and sizeof(InetHost) respectively.
  79.     // You should set hardwareAddress to point to a buffer 
  80.     // where the hardware address is returned.  You should give
  81.     // the size of the buffer in hardwareSize.  You should set
  82.     // flags to point to a buffer where the ARP cache entry's
  83.     // flags are returned.  See "OTARPModule.h" for
  84.     // a description of the possible flag values.
  85.  
  86. OSStatus ARPInterfaceUp(char *configString, UInt32 *interfaceCookie);
  87.     // Bring an ARP interface up.  configString is the
  88.     // name of the port over which to bring the interface up, ie
  89.     // the name you would pass to OTCreateConfiguration to address
  90.     // that port.  Aliases, such as "enet", are allowed.
  91.     // The UInt32 pointed to by interfaceCookie is set to a
  92.     // value you can pass to ARPInterfaceDown to tear the
  93.     // interface down.
  94.  
  95. OSStatus ARPInterfaceDown(UInt32 interfaceCookie);
  96.     // Tear an ARP interface down.  interfaceCookie is the
  97.     // value you got from ARPInterfaceUp when you brought the
  98.     // interface up.
  99.